// Copyright (C) 2008 Taylor L. Riche <riche@cs.utexas.edu>
//  
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software 
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//

#include "lc_shallow_op_Operator.h"

void 
shallow_op::shallowInspect(requestTypes::NetRequest * data, unsigned long dataSize)
{
  if(data->getFileName().length() > 30) {
    requestTypes::ControlMessage * cm = new requestTypes::ControlMessage(requestTypes::SUSPICIOUS, data->getSourceID());
    control_out(cm, sizeof(requestTypes::ControlMessage));
  }
  data_out(data, dataSize);
}

requestTypes::NetRequest *
shallow_op::gendata_inRequest()
{
  std::string request = "GET /index.html HTTP/1.1";
  request += "\r\n\r\n";
  char * request_str = new char[request.length()];
  strcpy(request_str, request.c_str());
  //  std::cerr << request_str << ":" << strlen(request_str) << ":" << request.length() << std::endl;
  return new requestTypes::NetRequest(request_str,strlen(request_str),0);

}

